﻿using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XH.DataUpload.Client.Global;

namespace XH.DataUpload.Client.ViewModels
{
    public class UserMainViewModel : BindableBase, INavigationAware
    {
        public bool IsNavigationTarget(NavigationContext navigationContext) => true;

        public void OnNavigatedFrom(NavigationContext navigationContext) { }

        public void OnNavigatedTo(NavigationContext navigationContext) { }

        public DelegateCommand<string> ShowMainRegionCommand { get; set; }
        private readonly IEventAggregator _eventAggregator;
        public UserMainViewModel(IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;
            ShowMainRegionCommand = new DelegateCommand<string>(DoShowMainRegion);

        }

        private void DoShowMainRegion(string obj)
        {
            _eventAggregator.GetEvent<EventMessage>().Publish(obj);
        }
    }
}
